package com.zheng.PointTest.mapper;

import com.zheng.PointTest.entity.userInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.beans.Transient;
import java.util.List;

/**
 * className:UserMapper
 * Package:com.zheng.PointTest.mapper
 * Description:
 *
 * @Author:ZhengJinLong Create:2024/6/30 - 23:50
 * @Version:v1.0
 */
@Mapper
public interface UserMapper {
    /**
     * 查询所有用户列表
     * @return
     */
    @Select("select * from userInfo")
    List<userInfo>  queryAllUser();

    /**
     * 更新或插入用户信息
     * @param user
     */
    @Update("INSERT INTO pointtest.`userInfo` (name,password) VALUES (#{name},#{password})")
    @Transient
    void registerUserByInfo(userInfo user);
    @Select("select * from userInfo where name = #{name}")
    userInfo queryUserByName(String userName);
}
